package com.zhiwang.planet.aop.sim

import com.zhiwang.planet.util.AppUtil
import com.zhiwang.planet.util.Toaster
import org.aspectj.lang.ProceedingJoinPoint
import org.aspectj.lang.annotation.Around
import org.aspectj.lang.annotation.Aspect

@Target(AnnotationTarget.FUNCTION)
annotation class SimRequired


@Aspect
open class SimRequiredAspect {

    private val TAG = "SimRequired"

    @Around("execution(@com.zhiwang.planet.aop.sim.SimRequired  * *(..))")
    fun simRequired(proceedingJoinPoint: ProceedingJoinPoint) {
        if (AppUtil.checkSimInsert())
            proceedingJoinPoint.proceed()
        else
            Toaster.message("未插入 sim 卡")
    }
}